import 'package:card_swiper/card_swiper.dart';
import 'package:flutter/material.dart';

class CartPage extends StatefulWidget {
  const CartPage({super.key});

  @override
  State<CartPage> createState() => _CartPageState();
}

class _CartPageState extends State<CartPage> {
  int _currentIndex = 0;
  final int _totalItems = 5;

  @override
  Widget build(BuildContext context) {
    return Column(
      children: [
        Container(
          width: double.infinity,
          height: 300,
          child: Swiper(
            itemCount: _totalItems,
            itemBuilder: (BuildContext context, int index) {
              return Container(
                // color: Colors.primaries[index % Colors.primaries.length],
                decoration: BoxDecoration(
                  border: Border.all(color: Colors.black, width: 1),
                  borderRadius: BorderRadius.circular(10)
                ),
                child: Center(
                  child: Text(
                    'Item $index',
                    style: TextStyle(fontSize: 24, color: Colors.white),
                  ),
                ),
              );
            },
            onIndexChanged: (index) {
              setState(() {
                _currentIndex = index;
              });
            },
            pagination: SwiperPagination(),
            control: SwiperControl(),
          ),
        ),
        LinearProgressIndicator(
          value: (_currentIndex + 1) / _totalItems,
        ),
      ],
    );
  }
}

